package com.mingtu.guards.adapter;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.StringUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mingtu.guards.R;
import com.mingtu.guards.bean.InfraredWarningBean;

public class WarningRecordAdapter extends BaseQuickAdapter<InfraredWarningBean.PageBean.ListBean, BaseViewHolder> {

    public WarningRecordAdapter() {
        super(R.layout.item_warning_record);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, InfraredWarningBean.PageBean.ListBean listBean) {
        String deviceName = listBean.getDeviceName(); //设备名字
        String time = listBean.getCreateTime();
        String msgType = listBean.getMsgType();
        String msgContent = listBean.getMsgContent();

        if (!StringUtils.isEmpty(deviceName)) {
            helper.setText(R.id.tv_name, "设备编号：" + deviceName);
        }

        if (!StringUtils.isEmpty(time)) {
            helper.setText(R.id.tv_warning_time, "报警时间：" + time);
        }

        if (!StringUtils.isEmpty(msgType)) {
            helper.setText(R.id.tv_warning_type, "报警类型：" + msgType);
        }

        if (!StringUtils.isEmpty(msgContent)) {
            helper.setText(R.id.tv_content, "报警事件：" + msgContent);
        }
    }


}
